Posts

Post not yet marked as solved
5 Replies
The ModelConfiguration is what you are looking for. I do not get chance to try it, but the WWDC video shows the way like: let people = ModelConfiguration(..., cloudKitContainerIdentifier: "com.***.***") let container = try ModelContainer(for: ..., people) I understand that SwiftData is a set of swift classes. However, I have some concerns about using them directly in the UI, as shown in the videos and the examples. This may lead to some problems: Performance issue. For instance, if a record contains some images, how can I handle them efficiently with SwiftData? I don't want to load all the image data in memory, but rather cache them in files and load the URL in the view model. Complicated logic. Using SwiftData models in the UI may be convenient for coding, but sometimes the logic may become too complex. We may need to create other view models based on the basic models. But SwiftData is not a lightweight variable, and I don't know how to track the changes of the SwiftData models in other custom @Observeable models. I have no more CoreData experience, would you please help to suggest the way to use SwiftData for my preceding concerns?
Post not yet marked as solved
5 Replies
One of the benefits of SwiftData is that it allows us to access CloudKit containers directly without having to deal with CKRecord and other low-level details. However, I am wondering which solution is better for an app that has a complex view model. Is SwiftData suitable for handling complex data structures and relationships? Or should we use the the traditional way to code the view models with CKSyncEngine for sync?
Post not yet marked as solved
11 Replies
We have a new open source SwiftUI package for the needs, at https://github.com/mobilinked/MbSwiftUIFirstResponder The SwiftUI style APIs TextField("Name", text: $name) .firstResponder(id: FirstResponders.name, firstResponder: $firstResponder, resignableUserOperations: .all) TextEditor(text: $notes) .firstResponder(id: FirstResponders.notes, firstResponder: $firstResponder, resignableUserOperations: .all) 2. Option for "tap to resign" for iOS 3. Option for "click to resign", "return key, esc key, ... to resign" for macOS It almost meets all the needs in the replies.
Post not yet marked as solved
2 Replies
Similar problem here: Using @SceneStorage to storage filtering state, sometimes the app crashed when changing the SceneStorage value. @SceneStorage("filtering-string", defaultValue: "") var filteringString: String This variable is used in two views, one for input and one to use it to show a list. Error message: AttributeGraph precondition failure: setting value during update
Post marked as solved
3 Replies
Same problem here using Xcode12 beta6
Post marked as solved
5 Replies
I have created a extension to prevent auto dismiss very easily, just call the way like: .sheet(isPresented: $presenting) { ModalContent() .allowAutoDismiss { false } } The code https://gist.github.com/mobilinked/9b6086b3760bcf1e5432932dad0813c0
Post not yet marked as solved
1 Replies
This bug stoped us to release the first SwiftUI app, and a feedback (FB7599129) has been fired at Feb, 2020. The problem is that for the language if we need to type multiple keys to input one character, the textfield does not work. @Apple, would you please help to suggest the solution, the textfield should be very basic I think.
Post marked as solved
3 Replies
Thanks @JakeShort Yes, we also think that Apple MAY combine the iOS and macOS (and the app stores) into one at future, and encourage to combine the the iOS, iPadOS and macOS apps together. Right now, we prefer to developer macOS app NOT using the Catalyst as we want to the app be a real Mac app to use platform-specific capabilities. But with the news about Apple silicon, we have no more idea about Apple's direction - combine all into one or still keeping them be separated. If Apple's direction is to combine them together, we will choose Catalyst.
Post not yet marked as solved
1 Replies
Can anybody help on it?I did not find any other way to know if the opened file is writable except the API to "isWritableFileAtPath", and I did not find any topic related about the file permission in the shared readonly iCloud Drive folder.
Post marked as solved
10 Replies
Just migrated to the xcode 13.3, the problem backs to the simulator- On the iOS device, it works well - BUT on the simulator, only the first tap works to navigate.